// import clc from 'cli-color'

const clc = require('cli-color');

export class Logger {
  // 定义一个用来打印日志的工具方法
  private static lastLogtamp = Date.now()
  // 定义一个用来打印日志的工具方法
  static log(message: string, context: string = '') {
    // 获取当前的时间戳
    const timestamp = new Date().toLocaleString()
    // 获取当前的进 id
    const pid = process.pid
    const currentTime = Date.now()
    const timeDiff = currentTime - this.lastLogtamp
    console.log(`[${clc.green('Nest')}] ${clc.green(pid)}  - ${timestamp}     ${clc.green('LOG')} [${clc.yellow(context)}] ${clc.green(message)} +${timeDiff}m`)
    this.lastLogtamp = currentTime
  }
}
